//
//  Sky72LikeCaddieCell.m
//  Sky72
//
//  Created by ladaka on 13. 10. 4..
//  Copyright (c) 2013년 ladaka Inc. All rights reserved.
//

#import "Sky72LikeCaddieCell.h"

@implementation Sky72LikeCaddieCell
@synthesize arrLikeType;
@synthesize delegate;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
//    self.lbLike.userInteractionEnabled = YES;

}

/*
- (IBAction)onClickLike:(id)sender {
    arrLikeType = [[NSArray alloc] initWithObjects:@"Like 캐디", @"미지정", nil];
    
    UIPickerView *pickerView = [[UIPickerView alloc] init];
    [pickerView setDelegate:self];
    [pickerView setDataSource:self];
    pickerView.showsSelectionIndicator = YES;
    
    UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
    
    [pickerView setFrame:CGRectMake(0, keyWindow.frame.size.height - pickerView.frame.size.height, keyWindow.frame.size.width, pickerView.frame.size.height)];
    
    [keyWindow addSubview:pickerView];
}
 

- (IBAction)onClickLike:(id)sender {
    
    arrLikeType = [[NSArray alloc] initWithObjects:@"Like 캐디", @"미지정", nil];
    
    UIActionSheet *actionSheet = [[UIActionSheet alloc] init];
    [actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
    
    CGRect pickerFrame = CGRectMake(0, 40, 320, 150);
    
    UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:pickerFrame];
    pickerView.showsSelectionIndicator = YES;
    pickerView.dataSource = self;
    pickerView.delegate = self;
    
    [actionSheet addSubview:pickerView];
    
    UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Close"]];
    closeButton.momentary = YES;
    closeButton.frame = CGRectMake(260, 7, 50, 30);
    closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
#ifdef __IPHONE_7_0
#else
    closeButton.tintColor = [UIColor blackColor];
#endif
    [closeButton addTarget:actionSheet action:@selector(dismissWithClickedButtonIndex:animated:) forControlEvents:UIControlEventValueChanged];
    
    [actionSheet addSubview:closeButton];
    
    [actionSheet showInView:[[UIApplication sharedApplication] keyWindow]];
    [actionSheet setBounds:CGRectMake(0, 0, 320, 385)];
}

#pragma mark - UIPickerViewDataSource, UIPickerViewDelegate
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
    return [arrLikeType count];
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    return [arrLikeType objectAtIndex:row];
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
//    [self.lbName setText:[arrLikeType objectAtIndex:row]];
//    [self.lbLike setText:[arrLikeType objectAtIndex:row]];
}
*/
- (IBAction)onClickBtn:(id)sender {
    [self.delegate clickLike:sender];
}
@end
